</head>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="databeans.User" %>
<%User user = (User) session.getAttribute("user");
 %>
<%if ((user!=null)&&(user.getType()==3)) {
%>
<c:choose>
<c:when test="${(not empty resp_survey) && (completed == 1)}">
	<body onload="setTimeout('delayedRedirect()', 2000)">
	<% session.setAttribute("user",null); %>
</c:when>
<c:otherwise>
	<body onload="changepage()">
</c:otherwise>
</c:choose>
<% }else { %>
<body onload="changepage()">
<% }%>
<script type="text/javascript">

function changelink(signal){
	document.cookie = signal;
}
function changepage(){
	var signal;
	var topbar = $(".top111");

	signal = document.cookie;
	topbar[signal-1].setAttribute("class","active");
}
function clearCookie(){
	//alert(1);
	//var topbar = $(".top111");
	//var num = topbar.length;
	//for(var i = 0; i <num; i++ ){
	//	topbar[i].setAttribute("class","top111");
	//}
	document.cookie = "";
}
</script>
<%@ page import="databeans.User" %>
<%
if (user == null) {
%>
	<div class="topbar">
		<div class="fill">
			<div class="container">
				<a class="brand" href="/413project/">IMS<sup>+</sup></a>
				<ul class="nav">
					<li class="active"><a href="/413project/">Home</a></li>
				</ul>
				<form class="pull-right" id="loginform" method="post" action="login.do">
					<input class="small" type="text" id="userid" name="userid" placeholder="userid" value="">
					<input class="small" type="password" name="password" placeholder="Password" value="">
				    <button type="submit" name="button" class="btn btn-inverse"  value="Login">Sign in</button>
				</form>
				<ul class="nav secondary-nav">
					<a href="#">Learn More</a>
				</ul>
					</div>
				</div>
			</div>
			<!--The administrator's page  -->
<%
	} else if(user.getType()==1){
%>
	<div class="topbar" data-dropdown="dropdown">
		<div class="fill">
			<div class="container" style="width:auto;">
<!-- 				<a class="brand" onclick="changelink(1)" href="schedule.do?">CASOS<sup>+</sup></a>
 -->				<ul class="nav">
 					<a class="brand" href="logout.do"><i class="icon-white icon-home"></i>IMS<sup>+</sup></a>
 						
				  <!--  <form class="navbar-search pull-left">
					<input type="text" class="search-query span2" placeholder="Search"/>
					</form> -->
				<ul class="nav secondary-nav">
					<a href="logout.do">Logout</a>			
				</ul>
				<ul class="nav secondary-nav">
				<li class="dropdown"> 
                   	 	<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-white icon-home"></i><%= user.getUserid() %></a> 
                    	<ul class="dropdown-menu"> 
                     	 <li><a href="#">Action</a></li> 
                      	<li><a href="#">Another action</a></li> 
                     	 <li><a href="#">Something else here</a></li> 
                     	 <li class="divider"></li> 
                     	 <li><a href="#">Separated link</a></li> 
                    	</ul> 
                  </li> 
				</ul>
			</div>
		</div>
	</div>
	<!-- The researcher's page  -->
<%
	} else if(user.getType()==2){
%>
	<div class="topbar" data-dropdown="dropdown">
		<div class="fill">
			<div class="container" style="width:auto;">
 				<ul class="nav">
 					<a class="brand" href="logout.do"><i class="icon-white icon-home"></i>IMS<sup>+</sup></a>
				</ul>
				<form action="viewsurvey.do" method="post">
					<input type="text" name="searcher" class="search-query span2" placeholder="Search"/>
					<button data-loading-text="loading..." class="btn btn-inverse"><img src="img/glyphicons_027_search.png" style="color:white;width:20px"/></button>
				</form>
				<ul class="nav secondary-nav">
					<a href="logout.do">Logout</a>
				</ul>
				<ul class="nav secondary-nav">
				<li class="dropdown"> 
                   	 	<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-white icon-user"></i><%= user.getUserid() %><!-- <b class="caret"></b> --></a> 
                    	<ul class="dropdown-menu"> 
                     	 <li><a href="#">Action</a></li> 
                      	<li><a href="#">Another action</a></li> 
                     	 <li><a href="#">Something else here</a></li> 
                     	 <li class="divider"></li> 
                     	 <li><a href="#">Separated link</a></li> 
                    	</ul> 
                 </li> 
				</ul>
			</div>
		</div>
	</div>

<%  // respondent's page
	} else if(user.getType()==3){
%>
	<div class="topbar" data-dropdown="dropdown">
		<div class="fill">
			<div class="container" style="width:auto;">
 				<ul class="nav">
				</ul>
				<ul class="nav secondary-nav">
					<a href="#">Learn More</a>
				</ul>
				<ul class="nav secondary-nav">
					<a href="logout.do"><i class="icon-white icon-home"></i>Our Home</a>
				</ul> 
			</div>
		</div>
	</div>
<%
	}
%>